using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Core_UIData_HTextLoader_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Core.UIData.HTextLoader);
            args = new Type[]{typeof(System.String)};
            method = type.GetMethod("FindFont", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, FindFont_0);
            args = new Type[]{typeof(huqiang.Core.HGUI.UIElement), typeof(huqiang.Data.FakeStruct), typeof(huqiang.Core.HGUI.UIInitializer)};
            method = type.GetMethod("LoadUI", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, LoadUI_1);
            args = new Type[]{typeof(UnityEngine.Component), typeof(huqiang.Data.DataBuffer)};
            method = type.GetMethod("SaveUI", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SaveUI_2);
            args = new Type[]{typeof(huqiang.Core.HGUI.HText), typeof(huqiang.Core.HGUI.HText)};
            method = type.GetMethod("CopyTo", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CopyTo_3);

            field = type.GetField("TextHelper", flag);
            app.RegisterCLRFieldGetter(field, get_TextHelper_0);
            app.RegisterCLRFieldSetter(field, set_TextHelper_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_TextHelper_0, AssignFromStack_TextHelper_0);
            field = type.GetField("fonts", flag);
            app.RegisterCLRFieldGetter(field, get_fonts_1);
            app.RegisterCLRFieldSetter(field, set_fonts_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_fonts_1, AssignFromStack_fonts_1);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Core.UIData.HTextLoader());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Core.UIData.HTextLoader[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* FindFont_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.String @str = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = huqiang.Core.UIData.HTextLoader.FindFont(@str);

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static StackObject* LoadUI_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Core.HGUI.UIInitializer @initializer = (huqiang.Core.HGUI.UIInitializer)typeof(huqiang.Core.HGUI.UIInitializer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Data.FakeStruct @fake = (huqiang.Data.FakeStruct)typeof(huqiang.Data.FakeStruct).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            huqiang.Core.HGUI.UIElement @com = (huqiang.Core.HGUI.UIElement)typeof(huqiang.Core.HGUI.UIElement).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            huqiang.Core.UIData.HTextLoader instance_of_this_method = (huqiang.Core.UIData.HTextLoader)typeof(huqiang.Core.UIData.HTextLoader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.LoadUI(@com, @fake, @initializer);

            return __ret;
        }

        static StackObject* SaveUI_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Data.DataBuffer @buffer = (huqiang.Data.DataBuffer)typeof(huqiang.Data.DataBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Component @com = (UnityEngine.Component)typeof(UnityEngine.Component).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            huqiang.Core.UIData.HTextLoader instance_of_this_method = (huqiang.Core.UIData.HTextLoader)typeof(huqiang.Core.UIData.HTextLoader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.SaveUI(@com, @buffer);

            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static StackObject* CopyTo_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Core.HGUI.HText @tar = (huqiang.Core.HGUI.HText)typeof(huqiang.Core.HGUI.HText).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Core.HGUI.HText @src = (huqiang.Core.HGUI.HText)typeof(huqiang.Core.HGUI.HText).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);


            huqiang.Core.UIData.HTextLoader.CopyTo(@src, @tar);

            return __ret;
        }


        static object get_TextHelper_0(ref object o)
        {
            return ((huqiang.Core.UIData.HTextLoader)o).TextHelper;
        }

        static StackObject* CopyToStack_TextHelper_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Core.UIData.HTextLoader)o).TextHelper;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_TextHelper_0(ref object o, object v)
        {
            ((huqiang.Core.UIData.HTextLoader)o).TextHelper = (huqiang.Data.FakeStructHelper)v;
        }

        static StackObject* AssignFromStack_TextHelper_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            huqiang.Data.FakeStructHelper @TextHelper = (huqiang.Data.FakeStructHelper)typeof(huqiang.Data.FakeStructHelper).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Core.UIData.HTextLoader)o).TextHelper = @TextHelper;
            return ptr_of_this_method;
        }

        static object get_fonts_1(ref object o)
        {
            return huqiang.Core.UIData.HTextLoader.fonts;
        }

        static StackObject* CopyToStack_fonts_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = huqiang.Core.UIData.HTextLoader.fonts;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_fonts_1(ref object o, object v)
        {
            huqiang.Core.UIData.HTextLoader.fonts = (System.Collections.Generic.List<UnityEngine.Font>)v;
        }

        static StackObject* AssignFromStack_fonts_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Collections.Generic.List<UnityEngine.Font> @fonts = (System.Collections.Generic.List<UnityEngine.Font>)typeof(System.Collections.Generic.List<UnityEngine.Font>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            huqiang.Core.UIData.HTextLoader.fonts = @fonts;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.Core.UIData.HTextLoader();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
